package com.sk.product.api;

import com.sk.product.model.ProductInfo;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

public interface ProductInterface {
    @RequestMapping("/{productId}")//声明调用的方法
    ProductInfo getProductById(@PathVariable("productId") Integer productId);

    //单个参数
    @RequestMapping("/p1")
    String p1(@RequestParam("id") Integer id);

    //多个参数
    @RequestMapping("/p2")
    String p2(@RequestParam("id")Integer id,@RequestParam("name")String name);

    //传递对象
    @RequestMapping("/p3")//@SpringQueryMap用于接收对象并绑定
    String p3(@SpringQueryMap ProductInfo productInfo);

    //json字符串
    @RequestMapping("/p4")//@RequestBody用于接收json
    String p4(@RequestBody ProductInfo productInfo);
}
